home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 1999 November / maximum-cd-1999-11.iso / Battlezone II / Disk1 / data1.cab / Program_Executable_Files / data.pak / interface_sprite.pl < prev    next >
Encoding:
Text File  |  1999-08-25  |  736 b   |  49 lines

  1. # find initial file
  2. $file = shift(@ARGV);
  3.  
  4. # set output to binary mode
  5. binmode(STDOUT);
  6.  
  7. # parse the initial file
  8. parse_file($file);
  9.  
  10. exit 0;
  11.  
  12. # read and parse a sprite table file
  13. sub parse_file
  14. {
  15.     local($file) = @_;
  16.  
  17.     print STDERR "reading $file:\n";
  18.  
  19.     local(@lines) = ();
  20.  
  21.     # open the file
  22.     open(FILE, $file);
  23.  
  24.     while (<FILE>)
  25.     {
  26.         # read file line
  27.         chop;
  28.         push(@lines, $_);
  29.     }
  30.  
  31.     # close the file
  32.     close(FILE);
  33.  
  34.     for (@lines)
  35.     {
  36.         if (/^\s*\@include "(.+)"/)
  37.         {
  38.             # include file
  39.             parse_file($1);
  40.         }
  41.         elsif (/^\s*\"(.*)\"\s+(\w+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+0x(\w+)/)
  42.         {
  43.             # write sprite table line
  44.             print pack("a32a8SSSSL", $1, $2, $3, $4, $5, $6, hex($7));
  45.         }
  46.     }
  47. }
  48.  
  49.